--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- Name: acl; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA acl;


ALTER SCHEMA acl OWNER TO postgres;

--
-- Name: menu; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA menu;


ALTER SCHEMA menu OWNER TO postgres;

--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


ALTER PROCEDURAL LANGUAGE plpgsql OWNER TO postgres;

SET search_path = acl, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: acl_action; Type: TABLE; Schema: acl; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_action (
    action_id integer NOT NULL,
    action_name character varying(150) NOT NULL,
    controller_id integer NOT NULL
);


ALTER TABLE acl.acl_action OWNER TO postgres;

--
-- Name: acl_action_action_id_seq; Type: SEQUENCE; Schema: acl; Owner: postgres
--

CREATE SEQUENCE acl_action_action_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE acl.acl_action_action_id_seq OWNER TO postgres;

--
-- Name: acl_action_action_id_seq; Type: SEQUENCE OWNED BY; Schema: acl; Owner: postgres
--

ALTER SEQUENCE acl_action_action_id_seq OWNED BY acl_action.action_id;


--
-- Name: acl_action_action_id_seq; Type: SEQUENCE SET; Schema: acl; Owner: postgres
--

SELECT pg_catalog.setval('acl_action_action_id_seq', 2, true);


--
-- Name: acl_controller; Type: TABLE; Schema: acl; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_controller (
    controller_id integer NOT NULL,
    controller_name character varying(255) NOT NULL,
    module_id integer NOT NULL
);


ALTER TABLE acl.acl_controller OWNER TO postgres;

--
-- Name: acl_controller_controller_id_seq; Type: SEQUENCE; Schema: acl; Owner: postgres
--

CREATE SEQUENCE acl_controller_controller_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE acl.acl_controller_controller_id_seq OWNER TO postgres;

--
-- Name: acl_controller_controller_id_seq; Type: SEQUENCE OWNED BY; Schema: acl; Owner: postgres
--

ALTER SEQUENCE acl_controller_controller_id_seq OWNED BY acl_controller.controller_id;


--
-- Name: acl_controller_controller_id_seq; Type: SEQUENCE SET; Schema: acl; Owner: postgres
--

SELECT pg_catalog.setval('acl_controller_controller_id_seq', 2, true);


--
-- Name: acl_module; Type: TABLE; Schema: acl; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_module (
    module_id integer NOT NULL,
    module_name character varying(255) NOT NULL
);


ALTER TABLE acl.acl_module OWNER TO postgres;

--
-- Name: acl_module_module_id_seq; Type: SEQUENCE; Schema: acl; Owner: postgres
--

CREATE SEQUENCE acl_module_module_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE acl.acl_module_module_id_seq OWNER TO postgres;

--
-- Name: acl_module_module_id_seq; Type: SEQUENCE OWNED BY; Schema: acl; Owner: postgres
--

ALTER SEQUENCE acl_module_module_id_seq OWNED BY acl_module.module_id;


--
-- Name: acl_module_module_id_seq; Type: SEQUENCE SET; Schema: acl; Owner: postgres
--

SELECT pg_catalog.setval('acl_module_module_id_seq', 3, true);


--
-- Name: acl_permission; Type: TABLE; Schema: acl; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_permission (
    permission_id integer NOT NULL,
    permission_obs character varying(255) NOT NULL,
    role_id integer NOT NULL,
    module_id integer NOT NULL,
    controller_id integer NOT NULL,
    action_id integer NOT NULL,
    resource_id integer NOT NULL
);


ALTER TABLE acl.acl_permission OWNER TO postgres;

--
-- Name: acl_permission_permission_id_seq; Type: SEQUENCE; Schema: acl; Owner: postgres
--

CREATE SEQUENCE acl_permission_permission_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE acl.acl_permission_permission_id_seq OWNER TO postgres;

--
-- Name: acl_permission_permission_id_seq; Type: SEQUENCE OWNED BY; Schema: acl; Owner: postgres
--

ALTER SEQUENCE acl_permission_permission_id_seq OWNED BY acl_permission.permission_id;


--
-- Name: acl_permission_permission_id_seq; Type: SEQUENCE SET; Schema: acl; Owner: postgres
--

SELECT pg_catalog.setval('acl_permission_permission_id_seq', 1, false);


--
-- Name: acl_resource; Type: TABLE; Schema: acl; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_resource (
    resource_id integer NOT NULL,
    resource_name character varying(255) NOT NULL
);


ALTER TABLE acl.acl_resource OWNER TO postgres;

--
-- Name: acl_resource_resource_id_seq; Type: SEQUENCE; Schema: acl; Owner: postgres
--

CREATE SEQUENCE acl_resource_resource_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE acl.acl_resource_resource_id_seq OWNER TO postgres;

--
-- Name: acl_resource_resource_id_seq; Type: SEQUENCE OWNED BY; Schema: acl; Owner: postgres
--

ALTER SEQUENCE acl_resource_resource_id_seq OWNED BY acl_resource.resource_id;


--
-- Name: acl_resource_resource_id_seq; Type: SEQUENCE SET; Schema: acl; Owner: postgres
--

SELECT pg_catalog.setval('acl_resource_resource_id_seq', 1, false);


--
-- Name: acl_role; Type: TABLE; Schema: acl; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_role (
    role_id integer NOT NULL,
    role_name character varying(255) NOT NULL
);


ALTER TABLE acl.acl_role OWNER TO postgres;

--
-- Name: acl_role_role_id_seq; Type: SEQUENCE; Schema: acl; Owner: postgres
--

CREATE SEQUENCE acl_role_role_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE acl.acl_role_role_id_seq OWNER TO postgres;

--
-- Name: acl_role_role_id_seq; Type: SEQUENCE OWNED BY; Schema: acl; Owner: postgres
--

ALTER SEQUENCE acl_role_role_id_seq OWNED BY acl_role.role_id;


--
-- Name: acl_role_role_id_seq; Type: SEQUENCE SET; Schema: acl; Owner: postgres
--

SELECT pg_catalog.setval('acl_role_role_id_seq', 3, true);


--
-- Name: acl_user; Type: TABLE; Schema: acl; Owner: postgres; Tablespace: 
--

CREATE TABLE acl_user (
    user_id integer NOT NULL,
    user_name character varying(255) NOT NULL,
    user_password character varying(155) NOT NULL,
    user_dt_inicio time without time zone NOT NULL,
    user_ativo boolean NOT NULL,
    role_id integer NOT NULL
);


ALTER TABLE acl.acl_user OWNER TO postgres;

--
-- Name: acl_user_user_id_seq; Type: SEQUENCE; Schema: acl; Owner: postgres
--

CREATE SEQUENCE acl_user_user_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE acl.acl_user_user_id_seq OWNER TO postgres;

--
-- Name: acl_user_user_id_seq; Type: SEQUENCE OWNED BY; Schema: acl; Owner: postgres
--

ALTER SEQUENCE acl_user_user_id_seq OWNED BY acl_user.user_id;


--
-- Name: acl_user_user_id_seq; Type: SEQUENCE SET; Schema: acl; Owner: postgres
--

SELECT pg_catalog.setval('acl_user_user_id_seq', 3, true);


--
-- Name: view_login; Type: VIEW; Schema: acl; Owner: postgres
--

CREATE VIEW view_login AS
    SELECT au.user_name AS username, au.user_password AS password, ar.role_name AS role FROM (acl_user au JOIN acl_role ar ON ((ar.role_id = au.role_id)));


ALTER TABLE acl.view_login OWNER TO postgres;

SET search_path = menu, pg_catalog;

--
-- Name: menu; Type: TABLE; Schema: menu; Owner: postgres; Tablespace: 
--

CREATE TABLE menu (
    menu_id integer NOT NULL,
    menu_name character varying(155) NOT NULL,
    menu_status boolean NOT NULL
);


ALTER TABLE menu.menu OWNER TO postgres;

--
-- Name: menu_menu_id_seq; Type: SEQUENCE; Schema: menu; Owner: postgres
--

CREATE SEQUENCE menu_menu_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE menu.menu_menu_id_seq OWNER TO postgres;

--
-- Name: menu_menu_id_seq; Type: SEQUENCE OWNED BY; Schema: menu; Owner: postgres
--

ALTER SEQUENCE menu_menu_id_seq OWNED BY menu.menu_id;


--
-- Name: menu_menu_id_seq; Type: SEQUENCE SET; Schema: menu; Owner: postgres
--

SELECT pg_catalog.setval('menu_menu_id_seq', 3, true);


--
-- Name: submenu; Type: TABLE; Schema: menu; Owner: postgres; Tablespace: 
--

CREATE TABLE submenu (
    submenu_id integer NOT NULL,
    submenu_name character varying(155) NOT NULL,
    submenu_status boolean NOT NULL,
    menu_id integer NOT NULL
);


ALTER TABLE menu.submenu OWNER TO postgres;

--
-- Name: submenu_submenu_id_seq; Type: SEQUENCE; Schema: menu; Owner: postgres
--

CREATE SEQUENCE submenu_submenu_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE menu.submenu_submenu_id_seq OWNER TO postgres;

--
-- Name: submenu_submenu_id_seq; Type: SEQUENCE OWNED BY; Schema: menu; Owner: postgres
--

ALTER SEQUENCE submenu_submenu_id_seq OWNED BY submenu.submenu_id;


--
-- Name: submenu_submenu_id_seq; Type: SEQUENCE SET; Schema: menu; Owner: postgres
--

SELECT pg_catalog.setval('submenu_submenu_id_seq', 2, true);


SET search_path = public, pg_catalog;

--
-- Name: categoria; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE categoria (
    categoria_id integer NOT NULL,
    categoria_titulo character varying(255) NOT NULL,
    categoria_descricao character varying(255),
    categoria_ativo boolean DEFAULT true,
    categoria_ordem integer NOT NULL
);


ALTER TABLE public.categoria OWNER TO postgres;

--
-- Name: categoria_categoria_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE categoria_categoria_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.categoria_categoria_id_seq OWNER TO postgres;

--
-- Name: categoria_categoria_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE categoria_categoria_id_seq OWNED BY categoria.categoria_id;


--
-- Name: categoria_categoria_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('categoria_categoria_id_seq', 7, true);


--
-- Name: documento; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE documento (
    documento_id integer NOT NULL,
    documento_titulo character varying(255),
    documento_num integer NOT NULL,
    documento_dt_inicio date NOT NULL,
    user_id integer NOT NULL,
    subcategoria_id integer NOT NULL
);


ALTER TABLE public.documento OWNER TO postgres;

--
-- Name: documento_documento_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE documento_documento_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.documento_documento_id_seq OWNER TO postgres;

--
-- Name: documento_documento_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE documento_documento_id_seq OWNED BY documento.documento_id;


--
-- Name: documento_documento_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('documento_documento_id_seq', 1, false);


--
-- Name: documento_documento_num_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE documento_documento_num_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.documento_documento_num_seq OWNER TO postgres;

--
-- Name: documento_documento_num_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE documento_documento_num_seq OWNED BY documento.documento_num;


--
-- Name: documento_documento_num_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('documento_documento_num_seq', 1, false);


--
-- Name: documento_revisao; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE documento_revisao (
    revisao_id integer NOT NULL,
    revisao_data date NOT NULL,
    documento_id integer NOT NULL,
    user_id integer NOT NULL
);


ALTER TABLE public.documento_revisao OWNER TO postgres;

--
-- Name: documento_revisao_revisao_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE documento_revisao_revisao_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.documento_revisao_revisao_id_seq OWNER TO postgres;

--
-- Name: documento_revisao_revisao_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE documento_revisao_revisao_id_seq OWNED BY documento_revisao.revisao_id;


--
-- Name: documento_revisao_revisao_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('documento_revisao_revisao_id_seq', 1, false);


--
-- Name: subcategoria; Type: TABLE; Schema: public; Owner: postgres; Tablespace: 
--

CREATE TABLE subcategoria (
    subcategoria_id integer NOT NULL,
    subcategoria_titulo character varying(255) NOT NULL,
    subcategoria_descricao character varying(255),
    subcategoria_data date NOT NULL,
    categoria_id integer NOT NULL
);


ALTER TABLE public.subcategoria OWNER TO postgres;

--
-- Name: subcategoria_categoria_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE subcategoria_categoria_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.subcategoria_categoria_id_seq OWNER TO postgres;

--
-- Name: subcategoria_categoria_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE subcategoria_categoria_id_seq OWNED BY subcategoria.categoria_id;


--
-- Name: subcategoria_categoria_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('subcategoria_categoria_id_seq', 1, false);


--
-- Name: subcategoria_subcategoria_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

CREATE SEQUENCE subcategoria_subcategoria_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE public.subcategoria_subcategoria_id_seq OWNER TO postgres;

--
-- Name: subcategoria_subcategoria_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE subcategoria_subcategoria_id_seq OWNED BY subcategoria.subcategoria_id;


--
-- Name: subcategoria_subcategoria_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('subcategoria_subcategoria_id_seq', 1, false);


SET search_path = acl, pg_catalog;

--
-- Name: action_id; Type: DEFAULT; Schema: acl; Owner: postgres
--

ALTER TABLE acl_action ALTER COLUMN action_id SET DEFAULT nextval('acl_action_action_id_seq'::regclass);


--
-- Name: controller_id; Type: DEFAULT; Schema: acl; Owner: postgres
--

ALTER TABLE acl_controller ALTER COLUMN controller_id SET DEFAULT nextval('acl_controller_controller_id_seq'::regclass);


--
-- Name: module_id; Type: DEFAULT; Schema: acl; Owner: postgres
--

ALTER TABLE acl_module ALTER COLUMN module_id SET DEFAULT nextval('acl_module_module_id_seq'::regclass);


--
-- Name: permission_id; Type: DEFAULT; Schema: acl; Owner: postgres
--

ALTER TABLE acl_permission ALTER COLUMN permission_id SET DEFAULT nextval('acl_permission_permission_id_seq'::regclass);


--
-- Name: resource_id; Type: DEFAULT; Schema: acl; Owner: postgres
--

ALTER TABLE acl_resource ALTER COLUMN resource_id SET DEFAULT nextval('acl_resource_resource_id_seq'::regclass);


--
-- Name: role_id; Type: DEFAULT; Schema: acl; Owner: postgres
--

ALTER TABLE acl_role ALTER COLUMN role_id SET DEFAULT nextval('acl_role_role_id_seq'::regclass);


--
-- Name: user_id; Type: DEFAULT; Schema: acl; Owner: postgres
--

ALTER TABLE acl_user ALTER COLUMN user_id SET DEFAULT nextval('acl_user_user_id_seq'::regclass);


SET search_path = menu, pg_catalog;

--
-- Name: menu_id; Type: DEFAULT; Schema: menu; Owner: postgres
--

ALTER TABLE menu ALTER COLUMN menu_id SET DEFAULT nextval('menu_menu_id_seq'::regclass);


--
-- Name: submenu_id; Type: DEFAULT; Schema: menu; Owner: postgres
--

ALTER TABLE submenu ALTER COLUMN submenu_id SET DEFAULT nextval('submenu_submenu_id_seq'::regclass);


SET search_path = public, pg_catalog;

--
-- Name: categoria_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE categoria ALTER COLUMN categoria_id SET DEFAULT nextval('categoria_categoria_id_seq'::regclass);


--
-- Name: documento_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE documento ALTER COLUMN documento_id SET DEFAULT nextval('documento_documento_id_seq'::regclass);


--
-- Name: documento_num; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE documento ALTER COLUMN documento_num SET DEFAULT nextval('documento_documento_num_seq'::regclass);


--
-- Name: revisao_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE documento_revisao ALTER COLUMN revisao_id SET DEFAULT nextval('documento_revisao_revisao_id_seq'::regclass);


--
-- Name: subcategoria_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE subcategoria ALTER COLUMN subcategoria_id SET DEFAULT nextval('subcategoria_subcategoria_id_seq'::regclass);


--
-- Name: categoria_id; Type: DEFAULT; Schema: public; Owner: postgres
--

ALTER TABLE subcategoria ALTER COLUMN categoria_id SET DEFAULT nextval('subcategoria_categoria_id_seq'::regclass);


SET search_path = acl, pg_catalog;

--
-- Data for Name: acl_action; Type: TABLE DATA; Schema: acl; Owner: postgres
--

COPY acl_action (action_id, action_name, controller_id) FROM stdin;
2	list	2
\.


--
-- Data for Name: acl_controller; Type: TABLE DATA; Schema: acl; Owner: postgres
--

COPY acl_controller (controller_id, controller_name, module_id) FROM stdin;
2	categoria	1
\.


--
-- Data for Name: acl_module; Type: TABLE DATA; Schema: acl; Owner: postgres
--

COPY acl_module (module_id, module_name) FROM stdin;
1	admin
3	library
\.


--
-- Data for Name: acl_permission; Type: TABLE DATA; Schema: acl; Owner: postgres
--

COPY acl_permission (permission_id, permission_obs, role_id, module_id, controller_id, action_id, resource_id) FROM stdin;
\.


--
-- Data for Name: acl_resource; Type: TABLE DATA; Schema: acl; Owner: postgres
--

COPY acl_resource (resource_id, resource_name) FROM stdin;
\.


--
-- Data for Name: acl_role; Type: TABLE DATA; Schema: acl; Owner: postgres
--

COPY acl_role (role_id, role_name) FROM stdin;
1	admins
2	users
\.


--
-- Data for Name: acl_user; Type: TABLE DATA; Schema: acl; Owner: postgres
--

COPY acl_user (user_id, user_name, user_password, user_dt_inicio, user_ativo, role_id) FROM stdin;
2	bob	e10adc3949ba59abbe56e057f20f883e	13:19:05.358	t	1
3	rob	e10adc3949ba59abbe56e057f20f883e	13:19:35.676	t	2
\.


SET search_path = menu, pg_catalog;

--
-- Data for Name: menu; Type: TABLE DATA; Schema: menu; Owner: postgres
--

COPY menu (menu_id, menu_name, menu_status) FROM stdin;
2	Roles	t
3	Modules	f
\.


--
-- Data for Name: submenu; Type: TABLE DATA; Schema: menu; Owner: postgres
--

COPY submenu (submenu_id, submenu_name, submenu_status, menu_id) FROM stdin;
2	Novos	t	2
\.


SET search_path = public, pg_catalog;

--
-- Data for Name: categoria; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY categoria (categoria_id, categoria_titulo, categoria_descricao, categoria_ativo, categoria_ordem) FROM stdin;
7	Conclusão	Teste	t	56
\.


--
-- Data for Name: documento; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY documento (documento_id, documento_titulo, documento_num, documento_dt_inicio, user_id, subcategoria_id) FROM stdin;
\.


--
-- Data for Name: documento_revisao; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY documento_revisao (revisao_id, revisao_data, documento_id, user_id) FROM stdin;
\.


--
-- Data for Name: subcategoria; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY subcategoria (subcategoria_id, subcategoria_titulo, subcategoria_descricao, subcategoria_data, categoria_id) FROM stdin;
\.


SET search_path = acl, pg_catalog;

--
-- Name: action_id_ck; Type: CONSTRAINT; Schema: acl; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_action
    ADD CONSTRAINT action_id_ck PRIMARY KEY (action_id);


--
-- Name: controller_id_ck; Type: CONSTRAINT; Schema: acl; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_controller
    ADD CONSTRAINT controller_id_ck PRIMARY KEY (controller_id);


--
-- Name: module_id_ck; Type: CONSTRAINT; Schema: acl; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_module
    ADD CONSTRAINT module_id_ck PRIMARY KEY (module_id);


--
-- Name: permission_id_ck; Type: CONSTRAINT; Schema: acl; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_permission
    ADD CONSTRAINT permission_id_ck PRIMARY KEY (permission_id);


--
-- Name: resource_id_ck; Type: CONSTRAINT; Schema: acl; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_resource
    ADD CONSTRAINT resource_id_ck PRIMARY KEY (resource_id);


--
-- Name: role_id_ck; Type: CONSTRAINT; Schema: acl; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_role
    ADD CONSTRAINT role_id_ck PRIMARY KEY (role_id);


--
-- Name: user_id_ck; Type: CONSTRAINT; Schema: acl; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY acl_user
    ADD CONSTRAINT user_id_ck PRIMARY KEY (user_id);


SET search_path = menu, pg_catalog;

--
-- Name: menu_id_ck; Type: CONSTRAINT; Schema: menu; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY menu
    ADD CONSTRAINT menu_id_ck PRIMARY KEY (menu_id);


--
-- Name: submenu_id; Type: CONSTRAINT; Schema: menu; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY submenu
    ADD CONSTRAINT submenu_id PRIMARY KEY (submenu_id);


SET search_path = public, pg_catalog;

--
-- Name: categoria_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY categoria
    ADD CONSTRAINT categoria_id PRIMARY KEY (categoria_id);


--
-- Name: documento_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY documento
    ADD CONSTRAINT documento_id PRIMARY KEY (documento_id);


--
-- Name: revisao_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY documento_revisao
    ADD CONSTRAINT revisao_id PRIMARY KEY (revisao_id);


--
-- Name: subcategoria_id; Type: CONSTRAINT; Schema: public; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY subcategoria
    ADD CONSTRAINT subcategoria_id PRIMARY KEY (subcategoria_id);


--
-- Name: fki_categoria_id; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX fki_categoria_id ON subcategoria USING btree (categoria_id);


--
-- Name: fki_documento_id; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX fki_documento_id ON documento_revisao USING btree (documento_id);


--
-- Name: fki_subcategoria_id; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX fki_subcategoria_id ON documento USING btree (subcategoria_id);


--
-- Name: fki_user_id; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX fki_user_id ON documento USING btree (user_id);


--
-- Name: fki_user_id_revisao; Type: INDEX; Schema: public; Owner: postgres; Tablespace: 
--

CREATE INDEX fki_user_id_revisao ON documento_revisao USING btree (user_id);


SET search_path = acl, pg_catalog;

--
-- Name: action_id_fck; Type: FK CONSTRAINT; Schema: acl; Owner: postgres
--

ALTER TABLE ONLY acl_permission
    ADD CONSTRAINT action_id_fck FOREIGN KEY (action_id) REFERENCES acl_action(action_id);


--
-- Name: controller_id_fck; Type: FK CONSTRAINT; Schema: acl; Owner: postgres
--

ALTER TABLE ONLY acl_permission
    ADD CONSTRAINT controller_id_fck FOREIGN KEY (controller_id) REFERENCES acl_controller(controller_id);


--
-- Name: controller_id_fck; Type: FK CONSTRAINT; Schema: acl; Owner: postgres
--

ALTER TABLE ONLY acl_action
    ADD CONSTRAINT controller_id_fck FOREIGN KEY (controller_id) REFERENCES acl_controller(controller_id);


--
-- Name: module_id_fck; Type: FK CONSTRAINT; Schema: acl; Owner: postgres
--

ALTER TABLE ONLY acl_permission
    ADD CONSTRAINT module_id_fck FOREIGN KEY (module_id) REFERENCES acl_module(module_id);


--
-- Name: module_id_fck; Type: FK CONSTRAINT; Schema: acl; Owner: postgres
--

ALTER TABLE ONLY acl_controller
    ADD CONSTRAINT module_id_fck FOREIGN KEY (module_id) REFERENCES acl_module(module_id);


--
-- Name: resource_id_fck; Type: FK CONSTRAINT; Schema: acl; Owner: postgres
--

ALTER TABLE ONLY acl_permission
    ADD CONSTRAINT resource_id_fck FOREIGN KEY (resource_id) REFERENCES acl_resource(resource_id);


--
-- Name: role_id_fck; Type: FK CONSTRAINT; Schema: acl; Owner: postgres
--

ALTER TABLE ONLY acl_permission
    ADD CONSTRAINT role_id_fck FOREIGN KEY (role_id) REFERENCES acl_role(role_id);


--
-- Name: role_id_fck; Type: FK CONSTRAINT; Schema: acl; Owner: postgres
--

ALTER TABLE ONLY acl_user
    ADD CONSTRAINT role_id_fck FOREIGN KEY (role_id) REFERENCES acl_role(role_id);


SET search_path = menu, pg_catalog;

--
-- Name: menu_id_fck; Type: FK CONSTRAINT; Schema: menu; Owner: postgres
--

ALTER TABLE ONLY submenu
    ADD CONSTRAINT menu_id_fck FOREIGN KEY (menu_id) REFERENCES menu(menu_id);


SET search_path = public, pg_catalog;

--
-- Name: categoria_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY subcategoria
    ADD CONSTRAINT categoria_id FOREIGN KEY (categoria_id) REFERENCES categoria(categoria_id);


--
-- Name: documento_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY documento_revisao
    ADD CONSTRAINT documento_id FOREIGN KEY (documento_id) REFERENCES documento(documento_id);


--
-- Name: subcategoria_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY documento
    ADD CONSTRAINT subcategoria_id FOREIGN KEY (subcategoria_id) REFERENCES subcategoria(subcategoria_id);


--
-- Name: user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY documento
    ADD CONSTRAINT user_id FOREIGN KEY (user_id) REFERENCES acl.acl_user(user_id);


--
-- Name: user_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY documento_revisao
    ADD CONSTRAINT user_id FOREIGN KEY (user_id) REFERENCES acl.acl_user(user_id);


--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
-- PostgreSQL database dump complete
--

